\(\int \frac {(a+b x+c x^2)^2}{(d+e x) (f+g x)} \, dx\) [815]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F(-1)]
   Maxima [A] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 27, antiderivative size = 184 \[ \int \frac {\left (a+b x+c x^2\right )^2}{(d+e x) (f+g x)} \, dx=\frac {\left (b^2 e^2 g^2-2 c e g (b e f+b d g-a e g)+c^2 \left (e^2 f^2+d e f g+d^2 g^2\right )\right ) x}{e^3 g^3}-\frac {c (c e f+c d g-2 b e g) x^2}{2 e^2 g^2}+\frac {c^2 x^3}{3 e g}+\frac {\left (c d^2-b d e+a e^2\right )^2 \log (d+e x)}{e^4 (e f-d g)}-\frac {\left (c f^2-b f g+a g^2\right )^2 \log (f+g x)}{g^4 (e f-d g)} \]

[Out]

(b^2*e^2*g^2-2*c*e*g*(-a*e*g+b*d*g+b*e*f)+c^2*(d^2*g^2+d*e*f*g+e^2*f^2))*x/e^3/g^3-1/2*c*(-2*b*e*g+c*d*g+c*e*f
)*x^2/e^2/g^2+1/3*c^2*x^3/e/g+(a*e^2-b*d*e+c*d^2)^2*ln(e*x+d)/e^4/(-d*g+e*f)-(a*g^2-b*f*g+c*f^2)^2*ln(g*x+f)/g
^4/(-d*g+e*f)

Rubi [A] (verified)

Time = 0.18 (sec) , antiderivative size = 184, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 1, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.037, Rules used = {907} \[ \int \frac {\left (a+b x+c x^2\right )^2}{(d+e x) (f+g x)} \, dx=\frac {x \left (-2 c e g (-a e g+b d g+b e f)+b^2 e^2 g^2+c^2 \left (d^2 g^2+d e f g+e^2 f^2\right )\right )}{e^3 g^3}+\frac {\log (d+e x) \left (a e^2-b d e+c d^2\right )^2}{e^4 (e f-d g)}-\frac {\log (f+g x) \left (a g^2-b f g+c f^2\right )^2}{g^4 (e f-d g)}-\frac {c x^2 (-2 b e g+c d g+c e f)}{2 e^2 g^2}+\frac {c^2 x^3}{3 e g} \]

[In]

Int[(a + b*x + c*x^2)^2/((d + e*x)*(f + g*x)),x]

[Out]

((b^2*e^2*g^2 - 2*c*e*g*(b*e*f + b*d*g - a*e*g) + c^2*(e^2*f^2 + d*e*f*g + d^2*g^2))*x)/(e^3*g^3) - (c*(c*e*f
+ c*d*g - 2*b*e*g)*x^2)/(2*e^2*g^2) + (c^2*x^3)/(3*e*g) + ((c*d^2 - b*d*e + a*e^2)^2*Log[d + e*x])/(e^4*(e*f -
 d*g)) - ((c*f^2 - b*f*g + a*g^2)^2*Log[f + g*x])/(g^4*(e*f - d*g))

Rule 907

Int[((d_.) + (e_.)*(x_))^(m_)*((f_.) + (g_.)*(x_))^(n_)*((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(p_.), x_Symbol] :
> Int[ExpandIntegrand[(d + e*x)^m*(f + g*x)^n*(a + b*x + c*x^2)^p, x], x] /; FreeQ[{a, b, c, d, e, f, g}, x] &
& NeQ[e*f - d*g, 0] && NeQ[b^2 - 4*a*c, 0] && NeQ[c*d^2 - b*d*e + a*e^2, 0] && IntegerQ[p] && ((EqQ[p, 1] && I
ntegersQ[m, n]) || (ILtQ[m, 0] && ILtQ[n, 0]))

Rubi steps \begin{align*} \text {integral}& = \int \left (\frac {b^2 e^2 g^2-2 c e g (b e f+b d g-a e g)+c^2 \left (e^2 f^2+d e f g+d^2 g^2\right )}{e^3 g^3}-\frac {c (c e f+c d g-2 b e g) x}{e^2 g^2}+\frac {c^2 x^2}{e g}+\frac {\left (c d^2-b d e+a e^2\right )^2}{e^3 (e f-d g) (d+e x)}+\frac {\left (c f^2-b f g+a g^2\right )^2}{g^3 (-e f+d g) (f+g x)}\right ) \, dx \\ & = \frac {\left (b^2 e^2 g^2-2 c e g (b e f+b d g-a e g)+c^2 \left (e^2 f^2+d e f g+d^2 g^2\right )\right ) x}{e^3 g^3}-\frac {c (c e f+c d g-2 b e g) x^2}{2 e^2 g^2}+\frac {c^2 x^3}{3 e g}+\frac {\left (c d^2-b d e+a e^2\right )^2 \log (d+e x)}{e^4 (e f-d g)}-\frac {\left (c f^2-b f g+a g^2\right )^2 \log (f+g x)}{g^4 (e f-d g)} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.10 (sec) , antiderivative size = 177, normalized size of antiderivative = 0.96 \[ \int \frac {\left (a+b x+c x^2\right )^2}{(d+e x) (f+g x)} \, dx=-\frac {e g (-e f+d g) x \left (6 b^2 e^2 g^2+6 c e g (2 a e g+b (-2 e f-2 d g+e g x))+c^2 \left (6 d^2 g^2-3 d e g (-2 f+g x)+e^2 \left (6 f^2-3 f g x+2 g^2 x^2\right )\right )\right )-6 \left (c d^2+e (-b d+a e)\right )^2 g^4 \log (d+e x)+6 e^4 \left (c f^2+g (-b f+a g)\right )^2 \log (f+g x)}{6 e^4 g^4 (e f-d g)} \]

[In]

Integrate[(a + b*x + c*x^2)^2/((d + e*x)*(f + g*x)),x]

[Out]

-1/6*(e*g*(-(e*f) + d*g)*x*(6*b^2*e^2*g^2 + 6*c*e*g*(2*a*e*g + b*(-2*e*f - 2*d*g + e*g*x)) + c^2*(6*d^2*g^2 -
3*d*e*g*(-2*f + g*x) + e^2*(6*f^2 - 3*f*g*x + 2*g^2*x^2))) - 6*(c*d^2 + e*(-(b*d) + a*e))^2*g^4*Log[d + e*x] +
 6*e^4*(c*f^2 + g*(-(b*f) + a*g))^2*Log[f + g*x])/(e^4*g^4*(e*f - d*g))

Maple [A] (verified)

Time = 0.62 (sec) , antiderivative size = 262, normalized size of antiderivative = 1.42

method result size
norman \(\frac {\left (2 a c \,e^{2} g^{2}+b^{2} e^{2} g^{2}-2 b c d e \,g^{2}-2 b c \,e^{2} f g +c^{2} d^{2} g^{2}+c^{2} d e f g +c^{2} e^{2} f^{2}\right ) x}{e^{3} g^{3}}+\frac {c^{2} x^{3}}{3 e g}+\frac {c \left (2 b e g -c d g -c e f \right ) x^{2}}{2 e^{2} g^{2}}+\frac {\left (a^{2} g^{4}-2 a b f \,g^{3}+2 a c \,f^{2} g^{2}+b^{2} f^{2} g^{2}-2 b c \,f^{3} g +c^{2} f^{4}\right ) \ln \left (g x +f \right )}{g^{4} \left (d g -e f \right )}-\frac {\left (a^{2} e^{4}-2 a b d \,e^{3}+2 a c \,d^{2} e^{2}+b^{2} d^{2} e^{2}-2 b c \,d^{3} e +c^{2} d^{4}\right ) \ln \left (e x +d \right )}{\left (d g -e f \right ) e^{4}}\) \(262\)
default \(\frac {\frac {1}{3} c^{2} x^{3} e^{2} g^{2}+b c \,e^{2} g^{2} x^{2}-\frac {1}{2} c^{2} d e \,g^{2} x^{2}-\frac {1}{2} c^{2} e^{2} f g \,x^{2}+2 a c \,e^{2} g^{2} x +b^{2} e^{2} g^{2} x -2 b c d e \,g^{2} x -2 b c \,e^{2} f g x +c^{2} d^{2} g^{2} x +c^{2} d e f g x +c^{2} e^{2} f^{2} x}{e^{3} g^{3}}+\frac {\left (-a^{2} e^{4}+2 a b d \,e^{3}-2 a c \,d^{2} e^{2}-b^{2} d^{2} e^{2}+2 b c \,d^{3} e -c^{2} d^{4}\right ) \ln \left (e x +d \right )}{e^{4} \left (d g -e f \right )}+\frac {\left (a^{2} g^{4}-2 a b f \,g^{3}+2 a c \,f^{2} g^{2}+b^{2} f^{2} g^{2}-2 b c \,f^{3} g +c^{2} f^{4}\right ) \ln \left (g x +f \right )}{g^{4} \left (d g -e f \right )}\) \(280\)
parallelrisch \(-\frac {-2 x^{3} c^{2} d \,e^{3} g^{4}+2 x^{3} c^{2} e^{4} f \,g^{3}+3 x^{2} c^{2} d^{2} e^{2} g^{4}-3 x^{2} c^{2} e^{4} f^{2} g^{2}-6 x \,b^{2} d \,e^{3} g^{4}+6 x \,b^{2} e^{4} f \,g^{3}-6 x \,c^{2} d^{3} e \,g^{4}+6 x \,c^{2} e^{4} f^{3} g +6 \ln \left (e x +d \right ) b^{2} d^{2} e^{2} g^{4}-6 \ln \left (g x +f \right ) b^{2} e^{4} f^{2} g^{2}-12 \ln \left (e x +d \right ) a b d \,e^{3} g^{4}+12 \ln \left (e x +d \right ) a c \,d^{2} e^{2} g^{4}-12 \ln \left (e x +d \right ) b c \,d^{3} e \,g^{4}+12 \ln \left (g x +f \right ) a b \,e^{4} f \,g^{3}-12 \ln \left (g x +f \right ) a c \,e^{4} f^{2} g^{2}+12 \ln \left (g x +f \right ) b c \,e^{4} f^{3} g -6 x^{2} b c d \,e^{3} g^{4}+6 x^{2} b c \,e^{4} f \,g^{3}-12 x a c d \,e^{3} g^{4}+12 x a c \,e^{4} f \,g^{3}+12 x b c \,d^{2} e^{2} g^{4}-12 x b c \,e^{4} f^{2} g^{2}-6 \ln \left (g x +f \right ) c^{2} e^{4} f^{4}+6 \ln \left (e x +d \right ) a^{2} e^{4} g^{4}+6 \ln \left (e x +d \right ) c^{2} d^{4} g^{4}-6 \ln \left (g x +f \right ) a^{2} e^{4} g^{4}}{6 e^{4} g^{4} \left (d g -e f \right )}\) \(430\)
risch \(\frac {c^{2} x^{3}}{3 e g}+\frac {b c \,x^{2}}{e g}-\frac {c^{2} d \,x^{2}}{2 e^{2} g}-\frac {c^{2} f \,x^{2}}{2 e \,g^{2}}+\frac {2 a c x}{e g}+\frac {b^{2} x}{e g}-\frac {2 b c d x}{e^{2} g}-\frac {2 b c f x}{e \,g^{2}}+\frac {c^{2} d^{2} x}{e^{3} g}+\frac {c^{2} d f x}{e^{2} g^{2}}+\frac {c^{2} f^{2} x}{e \,g^{3}}-\frac {\ln \left (e x +d \right ) a^{2}}{d g -e f}+\frac {2 \ln \left (e x +d \right ) a b d}{\left (d g -e f \right ) e}-\frac {2 \ln \left (e x +d \right ) a c \,d^{2}}{\left (d g -e f \right ) e^{2}}-\frac {\ln \left (e x +d \right ) b^{2} d^{2}}{\left (d g -e f \right ) e^{2}}+\frac {2 \ln \left (e x +d \right ) b c \,d^{3}}{\left (d g -e f \right ) e^{3}}-\frac {\ln \left (e x +d \right ) c^{2} d^{4}}{\left (d g -e f \right ) e^{4}}+\frac {\ln \left (-g x -f \right ) a^{2}}{d g -e f}-\frac {2 \ln \left (-g x -f \right ) a b f}{g \left (d g -e f \right )}+\frac {2 \ln \left (-g x -f \right ) a c \,f^{2}}{g^{2} \left (d g -e f \right )}+\frac {\ln \left (-g x -f \right ) b^{2} f^{2}}{g^{2} \left (d g -e f \right )}-\frac {2 \ln \left (-g x -f \right ) b c \,f^{3}}{g^{3} \left (d g -e f \right )}+\frac {\ln \left (-g x -f \right ) c^{2} f^{4}}{g^{4} \left (d g -e f \right )}\) \(462\)

[In]

int((c*x^2+b*x+a)^2/(e*x+d)/(g*x+f),x,method=_RETURNVERBOSE)

[Out]

(2*a*c*e^2*g^2+b^2*e^2*g^2-2*b*c*d*e*g^2-2*b*c*e^2*f*g+c^2*d^2*g^2+c^2*d*e*f*g+c^2*e^2*f^2)/e^3/g^3*x+1/3*c^2*
x^3/e/g+1/2*c/e^2/g^2*(2*b*e*g-c*d*g-c*e*f)*x^2+1/g^4*(a^2*g^4-2*a*b*f*g^3+2*a*c*f^2*g^2+b^2*f^2*g^2-2*b*c*f^3
*g+c^2*f^4)/(d*g-e*f)*ln(g*x+f)-(a^2*e^4-2*a*b*d*e^3+2*a*c*d^2*e^2+b^2*d^2*e^2-2*b*c*d^3*e+c^2*d^4)/(d*g-e*f)/
e^4*ln(e*x+d)

Fricas [A] (verification not implemented)

none

Time = 0.54 (sec) , antiderivative size = 313, normalized size of antiderivative = 1.70 \[ \int \frac {\left (a+b x+c x^2\right )^2}{(d+e x) (f+g x)} \, dx=\frac {6 \, {\left (c^{2} d^{4} - 2 \, b c d^{3} e - 2 \, a b d e^{3} + a^{2} e^{4} + {\left (b^{2} + 2 \, a c\right )} d^{2} e^{2}\right )} g^{4} \log \left (e x + d\right ) + 2 \, {\left (c^{2} e^{4} f g^{3} - c^{2} d e^{3} g^{4}\right )} x^{3} - 3 \, {\left (c^{2} e^{4} f^{2} g^{2} - 2 \, b c e^{4} f g^{3} - {\left (c^{2} d^{2} e^{2} - 2 \, b c d e^{3}\right )} g^{4}\right )} x^{2} + 6 \, {\left (c^{2} e^{4} f^{3} g - 2 \, b c e^{4} f^{2} g^{2} + {\left (b^{2} + 2 \, a c\right )} e^{4} f g^{3} - {\left (c^{2} d^{3} e - 2 \, b c d^{2} e^{2} + {\left (b^{2} + 2 \, a c\right )} d e^{3}\right )} g^{4}\right )} x - 6 \, {\left (c^{2} e^{4} f^{4} - 2 \, b c e^{4} f^{3} g - 2 \, a b e^{4} f g^{3} + a^{2} e^{4} g^{4} + {\left (b^{2} + 2 \, a c\right )} e^{4} f^{2} g^{2}\right )} \log \left (g x + f\right )}{6 \, {\left (e^{5} f g^{4} - d e^{4} g^{5}\right )}} \]

[In]

integrate((c*x^2+b*x+a)^2/(e*x+d)/(g*x+f),x, algorithm="fricas")

[Out]

1/6*(6*(c^2*d^4 - 2*b*c*d^3*e - 2*a*b*d*e^3 + a^2*e^4 + (b^2 + 2*a*c)*d^2*e^2)*g^4*log(e*x + d) + 2*(c^2*e^4*f
*g^3 - c^2*d*e^3*g^4)*x^3 - 3*(c^2*e^4*f^2*g^2 - 2*b*c*e^4*f*g^3 - (c^2*d^2*e^2 - 2*b*c*d*e^3)*g^4)*x^2 + 6*(c
^2*e^4*f^3*g - 2*b*c*e^4*f^2*g^2 + (b^2 + 2*a*c)*e^4*f*g^3 - (c^2*d^3*e - 2*b*c*d^2*e^2 + (b^2 + 2*a*c)*d*e^3)
*g^4)*x - 6*(c^2*e^4*f^4 - 2*b*c*e^4*f^3*g - 2*a*b*e^4*f*g^3 + a^2*e^4*g^4 + (b^2 + 2*a*c)*e^4*f^2*g^2)*log(g*
x + f))/(e^5*f*g^4 - d*e^4*g^5)

Sympy [F(-1)]

Timed out. \[ \int \frac {\left (a+b x+c x^2\right )^2}{(d+e x) (f+g x)} \, dx=\text {Timed out} \]

[In]

integrate((c*x**2+b*x+a)**2/(e*x+d)/(g*x+f),x)

[Out]

Timed out

Maxima [A] (verification not implemented)

none

Time = 0.20 (sec) , antiderivative size = 255, normalized size of antiderivative = 1.39 \[ \int \frac {\left (a+b x+c x^2\right )^2}{(d+e x) (f+g x)} \, dx=\frac {{\left (c^{2} d^{4} - 2 \, b c d^{3} e - 2 \, a b d e^{3} + a^{2} e^{4} + {\left (b^{2} + 2 \, a c\right )} d^{2} e^{2}\right )} \log \left (e x + d\right )}{e^{5} f - d e^{4} g} - \frac {{\left (c^{2} f^{4} - 2 \, b c f^{3} g - 2 \, a b f g^{3} + a^{2} g^{4} + {\left (b^{2} + 2 \, a c\right )} f^{2} g^{2}\right )} \log \left (g x + f\right )}{e f g^{4} - d g^{5}} + \frac {2 \, c^{2} e^{2} g^{2} x^{3} - 3 \, {\left (c^{2} e^{2} f g + {\left (c^{2} d e - 2 \, b c e^{2}\right )} g^{2}\right )} x^{2} + 6 \, {\left (c^{2} e^{2} f^{2} + {\left (c^{2} d e - 2 \, b c e^{2}\right )} f g + {\left (c^{2} d^{2} - 2 \, b c d e + {\left (b^{2} + 2 \, a c\right )} e^{2}\right )} g^{2}\right )} x}{6 \, e^{3} g^{3}} \]

[In]

integrate((c*x^2+b*x+a)^2/(e*x+d)/(g*x+f),x, algorithm="maxima")

[Out]

(c^2*d^4 - 2*b*c*d^3*e - 2*a*b*d*e^3 + a^2*e^4 + (b^2 + 2*a*c)*d^2*e^2)*log(e*x + d)/(e^5*f - d*e^4*g) - (c^2*
f^4 - 2*b*c*f^3*g - 2*a*b*f*g^3 + a^2*g^4 + (b^2 + 2*a*c)*f^2*g^2)*log(g*x + f)/(e*f*g^4 - d*g^5) + 1/6*(2*c^2
*e^2*g^2*x^3 - 3*(c^2*e^2*f*g + (c^2*d*e - 2*b*c*e^2)*g^2)*x^2 + 6*(c^2*e^2*f^2 + (c^2*d*e - 2*b*c*e^2)*f*g +
(c^2*d^2 - 2*b*c*d*e + (b^2 + 2*a*c)*e^2)*g^2)*x)/(e^3*g^3)

Giac [A] (verification not implemented)

none

Time = 0.27 (sec) , antiderivative size = 289, normalized size of antiderivative = 1.57 \[ \int \frac {\left (a+b x+c x^2\right )^2}{(d+e x) (f+g x)} \, dx=\frac {{\left (c^{2} d^{4} - 2 \, b c d^{3} e + b^{2} d^{2} e^{2} + 2 \, a c d^{2} e^{2} - 2 \, a b d e^{3} + a^{2} e^{4}\right )} \log \left ({\left | e x + d \right |}\right )}{e^{5} f - d e^{4} g} - \frac {{\left (c^{2} f^{4} - 2 \, b c f^{3} g + b^{2} f^{2} g^{2} + 2 \, a c f^{2} g^{2} - 2 \, a b f g^{3} + a^{2} g^{4}\right )} \log \left ({\left | g x + f \right |}\right )}{e f g^{4} - d g^{5}} + \frac {2 \, c^{2} e^{2} g^{2} x^{3} - 3 \, c^{2} e^{2} f g x^{2} - 3 \, c^{2} d e g^{2} x^{2} + 6 \, b c e^{2} g^{2} x^{2} + 6 \, c^{2} e^{2} f^{2} x + 6 \, c^{2} d e f g x - 12 \, b c e^{2} f g x + 6 \, c^{2} d^{2} g^{2} x - 12 \, b c d e g^{2} x + 6 \, b^{2} e^{2} g^{2} x + 12 \, a c e^{2} g^{2} x}{6 \, e^{3} g^{3}} \]

[In]

integrate((c*x^2+b*x+a)^2/(e*x+d)/(g*x+f),x, algorithm="giac")

[Out]

(c^2*d^4 - 2*b*c*d^3*e + b^2*d^2*e^2 + 2*a*c*d^2*e^2 - 2*a*b*d*e^3 + a^2*e^4)*log(abs(e*x + d))/(e^5*f - d*e^4
*g) - (c^2*f^4 - 2*b*c*f^3*g + b^2*f^2*g^2 + 2*a*c*f^2*g^2 - 2*a*b*f*g^3 + a^2*g^4)*log(abs(g*x + f))/(e*f*g^4
 - d*g^5) + 1/6*(2*c^2*e^2*g^2*x^3 - 3*c^2*e^2*f*g*x^2 - 3*c^2*d*e*g^2*x^2 + 6*b*c*e^2*g^2*x^2 + 6*c^2*e^2*f^2
*x + 6*c^2*d*e*f*g*x - 12*b*c*e^2*f*g*x + 6*c^2*d^2*g^2*x - 12*b*c*d*e*g^2*x + 6*b^2*e^2*g^2*x + 12*a*c*e^2*g^
2*x)/(e^3*g^3)

Mupad [B] (verification not implemented)

Time = 12.14 (sec) , antiderivative size = 266, normalized size of antiderivative = 1.45 \[ \int \frac {\left (a+b x+c x^2\right )^2}{(d+e x) (f+g x)} \, dx=x\,\left (\frac {b^2+2\,a\,c}{e\,g}+\frac {\left (\frac {c^2\,\left (d\,g+e\,f\right )}{e^2\,g^2}-\frac {2\,b\,c}{e\,g}\right )\,\left (d\,g+e\,f\right )}{e\,g}-\frac {c^2\,d\,f}{e^2\,g^2}\right )-x^2\,\left (\frac {c^2\,\left (d\,g+e\,f\right )}{2\,e^2\,g^2}-\frac {b\,c}{e\,g}\right )+\frac {\ln \left (d+e\,x\right )\,\left (e^2\,\left (b^2\,d^2+2\,a\,c\,d^2\right )+a^2\,e^4+c^2\,d^4-2\,a\,b\,d\,e^3-2\,b\,c\,d^3\,e\right )}{e^5\,f-d\,e^4\,g}+\frac {\ln \left (f+g\,x\right )\,\left (g^2\,\left (b^2\,f^2+2\,a\,c\,f^2\right )+a^2\,g^4+c^2\,f^4-2\,a\,b\,f\,g^3-2\,b\,c\,f^3\,g\right )}{d\,g^5-e\,f\,g^4}+\frac {c^2\,x^3}{3\,e\,g} \]

[In]

int((a + b*x + c*x^2)^2/((f + g*x)*(d + e*x)),x)

[Out]

x*((2*a*c + b^2)/(e*g) + (((c^2*(d*g + e*f))/(e^2*g^2) - (2*b*c)/(e*g))*(d*g + e*f))/(e*g) - (c^2*d*f)/(e^2*g^
2)) - x^2*((c^2*(d*g + e*f))/(2*e^2*g^2) - (b*c)/(e*g)) + (log(d + e*x)*(e^2*(b^2*d^2 + 2*a*c*d^2) + a^2*e^4 +
 c^2*d^4 - 2*a*b*d*e^3 - 2*b*c*d^3*e))/(e^5*f - d*e^4*g) + (log(f + g*x)*(g^2*(b^2*f^2 + 2*a*c*f^2) + a^2*g^4
+ c^2*f^4 - 2*a*b*f*g^3 - 2*b*c*f^3*g))/(d*g^5 - e*f*g^4) + (c^2*x^3)/(3*e*g)